package com.nwork.cateye.fragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.handmark.pulltorefresh.library.PullToRefreshBase;
import com.handmark.pulltorefresh.library.PullToRefreshListView;
import com.nwork.cateye.R;
import com.nwork.cateye.adapter.CommunityListViewAdapter;

import java.util.ArrayList;

/**
 * 社区Fragment
 */
public class CommunityFragment extends Fragment {
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_communtity, container, false);
        PullToRefreshListView pullToRefresh= (PullToRefreshListView) view.findViewById(R.id.pullToRefresh);
        ListView listView = pullToRefresh.getRefreshableView();
        pullToRefresh.setMode(PullToRefreshBase.Mode.BOTH);
        ArrayList<String> data = new ArrayList<>();
        for(int i=0;i<100;i++){
            data.add("测试"+i);
        }
        CommunityListViewAdapter communityListViewAdapter=new CommunityListViewAdapter(getActivity(),data);
        listView.setAdapter(communityListViewAdapter);

        return view;
    }



}
